﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="_s.aspx.cs" Inherits="ZF.WS.Person.expert._s" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <link href="/css/common.css" rel="stylesheet" type="text/css" />
    <link href="/css/default.css1" rel="stylesheet" type="text/css" />

    <script src="/js/jQuery.js" type="text/javascript"></script>

    <script src="js/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="/js/calendar.js" type="text/javascript"></script>
    <script src="/js/index.js" type="text/javascript"></script>

    <script src="/js/jqPlugins/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="/js/jqPlugins/onlypressnum.js" type="text/javascript"></script>
    <script src="/js/char.js" type="text/javascript"></script>

    <link href="/css/char.css" rel="stylesheet" type="text/css" />
    <style>
        * { margin: 0px; padding: 0px; font-size: 12px; list-style: none; font-family: 宋体,arial,verdana,sans-serif,fantasy,tahoma; }
    </style>

 
    <script>
        $(function() {
            SlideInit();
        });
        function SlideInit() {
            $(".board").each(function() {
                var board = this;
                $(board).find("dt a.slide").click(function() {
                    $(board).find("dd.slide").hide();
                    $(board).find("a.slide").removeClass("active");
                    $("." + $(this).attr("bind")).show();
                    $(this).addClass("active");
                });
            });
        }
    </script>
    <script>
        function _refTxt() {
            window.parent._refTxt(RoomKey);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
          
                <link href="/fckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />

                <script type="text/javascript" src="/fckeditor/fckeditor.js"></script>

                <style>
                    #br { height: 250px; margin-bottom: 5px; background: #fafafa; border: 1px solid #BCDDF4; overflow: scroll; }
                    #br dl { margin-bottom: 5px; border-bottom: 1px solid #eee; margin-left: 5px; }
                    #br dl dt { text-align: left; }
                    #br dl dt.dt1 { color: #008040; }
                    #br dl dt.dt2 { color: #44B8FB; }
                    #br dl dd { margin-left: 10px; margin-top: 5px; text-align: left; }
                    #br dl dd img { margin: 1px; }
                    #br dl dd.sys { color: #f00; font-size: 14px; }
                    
                </style>
                <div class="board conntil <%=Request.Url.ToString().IndexOf("tolc.aspx?")!=-1?"":"dn_" %>">
                    <dl>
                        <dt><span>正在与 进行在线咨询</span></dt></dl>
                </div>
                <div id="br">
                </div>

                <script type="text/javascript">
         var sBasePath = "/fckeditor/"
         var oFCKeditor = new FCKeditor('FCKeditor1');
         oFCKeditor.BasePath = sBasePath;
         oFCKeditor.ToolbarSet = 'Chat';
         oFCKeditor.Value = '';
         oFCKeditor.Create();
 
         var memberId=<%=this.CurrentUser.MemberId %>;
         var expert="对方";
         var asmxPage = "/WSChat.asmx"
          var RoomKey = "<%=this.RoomKey %>";
          var editor = null;
                </script>
 
                <script type="text/javascript">
                  
                    $(function() {
                        initEvent();
                        setInterval("__rec()", 1000);
                    });
          
                    function initEvent() {
                        $("#billing .btn").click(function() {
                            $(".zfset").show();
                            $(".mbd").show();
                        });
                       
                        $("#stop").click(function() {
                            _stop();
                        });
                        $(".mbd").css({
                            width: $(document).width(),
                            height: $(document).height()
                        });
                        $(".inteSetCancel").click(function() {
                            $(".zfset").hide();
                            $(".mbd").hide();
                        });
                        $(".inteSetOk").click(function() {
                            if (_setInte()) {
                                _billing();
                                $(".zfset").hide();
                                $(".mbd").hide();
                            } else {
                                alert("设置积分失败");
                                $(".zfset").hide();
                                $(".mbd").hide();
                            }
                        });
                        
                        
                    }
                    function _setInte() {
                        var data = { roomKey: RoomKey, inte: parseInt($(".zfset select")[0].value) };
                        var result = false;
                        ajax($.toJSON(data), "SetInte", function(msg) {
                            msg = $.evalJSON(msg); result = msg.d; ;
                        });
                        return result;
                    }
                    
                     
                    function gettime() {
                        var today = new Date();
                        var h = today.getHours();
                        var m = today.getMinutes();
                        var s = today.getSeconds();
                        return String.format("{0}:{1}:{2}", h, m, s);
                    }
                    function __send(msg) {
                        var data = { memberId: memberId, msg: msg, roomKey: RoomKey };
                        ajax($.toJSON(data), "Send", function(msg) {
                            msg = $.evalJSON(msg).d;
                            if (msg != null) {
                                if (msg.IType == 1) {
                                    $("#br").append(String.format("<dl><dt class='dt1'>{1}&nbsp;&nbsp;&nbsp;&nbsp;{2}</dt><dd>{0}</dd></dl>",
                                    msg.Msg, msg.FromMember, gettime()));
                                } else {
                                    if (msg.IType == 10 || msg.IType == 11 || msg.IType == 20 || msg.IType == 21) {
                                        $(".conntil dt span").html(String.format("与{0}的会话已中断", expert));
                                    }
                                    $("#br").append(String.format("<dl><dd class='sys'>系统消息：{0}</dd></dl>",
                                    msg.Msg, msg.FromMember, gettime()));
                                }
                                _setDivScrollTop();
                            }
                        });
                    }
                    function __rec() {

                        ajax(String.format("{memberId:{0},roomKey:'{1}'}", memberId, RoomKey), "Rec", function(msg) {
                            var str = msg;
                            var msg = $.evalJSON(msg).d;
                            if (msg.length > 0) {
                                $(msg).each(function() {
                                    if (this.IType == 1) {
                                        $("#br").append(String.format("<dl><dt class='dt2'>{1}&nbsp;&nbsp;&nbsp;&nbsp;{2}</dt><dd>{0}</dd></dl>",
                             this.Msg, this.FromMember, gettime()));
                                    } else {
                                        if (this.IType == 10 || this.IType == 11 || this.IType == 20 || this.IType == 21) {
                                            $(".conntil dt span").html(String.format("与{0}的会话已中断", expert));
                                        }
                                        if (this.IType == 52) {

                                            $("#billing").hide();
                                            $("#stop").show();

                                        } else if (this.IType == 53) {

                                            $("#billing").show();
                                            $("#stop").hide();
                                            $(".billingInfo").removeAttr("disabled");

                                        } else if (this.IType == 54) {

                                            $(".billingInfo").html(String.format("你还有{0}积分", this.Msg));
                                            return true;
                                        }
                                        $("#br").append(String.format("<dl><dd class='sys'>系统消息：{0}</dd></dl>",
                             this.Msg, this.FromMember, gettime()));
                                    }
                                    _refTxt();
                                    _setDivScrollTop();
                                });
                                window.focus();
                            }

                        

                        });
                        
                      
                    }
                    function _billing() {
                        var data = {  roomKey: RoomKey };
                        ajax($.toJSON(data),"ApplyBilling",null);
                         
                    }
                    function _stop() {
                        var data = { roomKey: RoomKey };
                        var success = false;
                        ajax($.toJSON(data), "ApplyStop", function(msg) { success = $.evalJSON(msg).d; });
                        if (success) {
                            
                            $("#stop").hide();
                            $("#billing").show();
                        }
                    }
                    function _setDivScrollTop() {
                        $("#br")[0].scrollTop = $("#br")[0].scrollHeight;
                    }
                    $(function() {
                    $(".ttc").click(function() {
                            alert($("#stop").length);
                            alert($("#stop").attr("class"));
                        });
                    });
                </script>
 
        
            <div class="tar_ pr10_ mb10_  vam_">
                <span class=" fl_">
                    <input type="radio" name="qjj" class="qjj" id="qjj1" checked="checked" /><label for="qjj1">Enter发送</label>
                    <input type="radio" name="qjj" class="qjj" id="qjj2" /><label for="qjj2">Ctrl+S发送</label>
                    <input type="radio" name="qjj" class="qjj" id="qjj3" /><label for="qjj3">Ctrl+Enter发送</label>
                    
                    
                    
                    &nbsp;
                    <span class=' <%=_member.ExpertType == 1 || _member.ExpertType==2 ?"":"dn_"%>'>
                    
                        <span  id="billing" >
                        
                            <input type="button"  class="linkbtn btn" value="开始计费通话 " />
                        </span>
                        
                        <input type="button" class="linkbtn dn_" id="stop" value="停止计费通话" />
                    </span>
                    
                    <span class='billingInfo'>&nbsp;&nbsp;你还有<%= _member.Integral%>积分</span>
                </span>
                <input type="button" id="send" value=" 发 送 "  class="linkbtn" />
                <input type="button" id="clear" value=" 清 空 "  class="linkbtn" />
            </div>
 
        </div>
    
    </div>
    <style>
    .zfset{position:absolute; top:50%; display:none; left:35%; background:#fff; width:330px;border:2px solid #BCDDF4; }
    .zfset dt{ line-height:30px; height:30px; padding-left:20px; border-bottom:1px solid #BCDDF4; font-size:14px; 
               font-weight:bold;  vertical-align:middle;  background:url(/image/081.gif) no-repeat 5px 10px;}
    .zfset dd{ padding:10px; line-height:25px; height:25px;font-size:14px;}
    .mbd{ position:absolute; background:#eee; top:0px; left:0px; display:none;
           filter: alpha(opacity=80); -moz-opacity: 0.8; opacity: 0.8;}
    </style>
      <div class="mbd">
       
      </div>
     <div class="zfset" >
            <dl>
                <dt>  在线咨询积分设置</dt>
                <dd>
                    积分设置:<select>
                    <%for (int i = 1; i <= 10; i++){ %>
                    <option value="<%=i %>"  ><%=i %></option>
                    <%} %>
                    </select>积分/分钟<br />
                    设置相应积分并经对方确认后进行计时计分咨询，<br />
                    系统每分钟将对方相应的积分转移到您的帐户。<br />
                    <div class="tac_" style="border-top:1px solid #BCDDF4; padding-top:10px; ">
                    <input type="button"  value=" 确 定 "  class="linkbtn inteSetOk" />
                    <input type="button"   value=" 取 消 "  class="linkbtn inteSetCancel" /></div>
                </dd>
            </dl>
        </div>
    
      
    </form>
</body>
</html>
